import {ChangeDetectorRef, Component} from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {JidihttpProvider} from "../../providers/jidihttp/jidihttp";
import { DomSanitizer } from '@angular/platform-browser';
/**
 * Generated class for the KepujidiinfoPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-kepujidiinfo',
  templateUrl: 'kepujidiinfo.html',
})
export class KepujidiinfoPage {
  /** bozhu **/
  jidiMoviesbozhu: Array<any>=[];
  /** 列表 基地 **/
  tasklistbozhu:Array<any>=[];//list列表
  jidiid:string;
  //content
  jidi_name:string;
  jidi_time:string;
  jidi_image:string;
  jidi_content:string;
  fuwenben:string;
  constructor(public sanitizer:DomSanitizer,public navCtrl: NavController, public navParams: NavParams,public cdchange:ChangeDetectorRef,public jidiProvider:JidihttpProvider) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad KepujidiinfoPage');
    this.jidiid=this.navParams.get('uuid')
    this.jidihttpInfoClinet(this.jidiid);
  }

  /** 网络请求 **/
  jidihttpInfoClinet(uuid){
    this.jidiProvider.getHotjidiinfo(uuid).subscribe(data => {
      this.jidi_name = data['data']['popularScienceBase']["title"];
      this.jidi_time = data['data']['popularScienceBase']["createTime"];
      this.jidi_image = data['data']['popularScienceBase']["img"];
      this.jidi_content = data['data']['popularScienceBase']["remark"];
      this.fuwenben = data['data']['popularScienceBase']["content"];
      if(data['data']['champions']['length']>0) {
        for (let i = 0; i < data['data']['champions']['length']; i++) {
          this.jidiMoviesbozhu.push(data['data']['champions'][i]);
        }
        //alert(this.jidiMovies);
        this.tasklistbozhu = this.jidiMoviesbozhu;
      }

      this.cdchange.detectChanges();
    },error => {

    });

  }


assembleHTML(strHTML:any){
  return this.sanitizer.bypassSecurityTrustHtml(strHTML);
}

}
